package org.sport.model.entityModel;

import javax.persistence.*;

/**
 * Created by Allen on 2017/9/29.
 */
@Entity
@Table(name = "userprivatetable", schema = "sportinfo", catalog = "")
public class UserprivatetableEntity {
    private String userName;
    private Double totWalkDis;
    private Double totRunDis;
    private Double totCycDis;
    private Integer height;
    private Double weight;
    private Double bodyFatRate;
    private Double totSpoTim;
    private Integer sex;
    private int id;
    private UsertableEntity usertableByUserId;

    @Basic
    @Column(name = "userName", nullable = true, length = 45)
    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    @Basic
    @Column(name = "totWalkDis", nullable = true, precision = 0)
    public Double getTotWalkDis() {
        return totWalkDis;
    }

    public void setTotWalkDis(Double totWalkDis) {
        this.totWalkDis = totWalkDis;
    }

    @Basic
    @Column(name = "totRunDis", nullable = true, precision = 0)
    public Double getTotRunDis() {
        return totRunDis;
    }

    public void setTotRunDis(Double totRunDis) {
        this.totRunDis = totRunDis;
    }

    @Basic
    @Column(name = "totCycDis", nullable = true, precision = 0)
    public Double getTotCycDis() {
        return totCycDis;
    }

    public void setTotCycDis(Double totCycDis) {
        this.totCycDis = totCycDis;
    }

    @Basic
    @Column(name = "height", nullable = true)
    public Integer getHeight() {
        return height;
    }

    public void setHeight(Integer height) {
        this.height = height;
    }

    @Basic
    @Column(name = "weight", nullable = true, precision = 0)
    public Double getWeight() {
        return weight;
    }

    public void setWeight(Double weight) {
        this.weight = weight;
    }

    @Basic
    @Column(name = "bodyFatRate", nullable = true, precision = 0)
    public Double getBodyFatRate() {
        return bodyFatRate;
    }

    public void setBodyFatRate(Double bodyFatRate) {
        this.bodyFatRate = bodyFatRate;
    }

    @Basic
    @Column(name = "totSpoTim", nullable = true, precision = 0)
    public Double getTotSpoTim() {
        return totSpoTim;
    }

    public void setTotSpoTim(Double totSpoTim) {
        this.totSpoTim = totSpoTim;
    }

    @Basic
    @Column(name = "sex", nullable = true)
    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    @Id
    @Column(name = "_id", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        UserprivatetableEntity that = (UserprivatetableEntity) o;

        if (id != that.id) return false;
        if (userName != null ? !userName.equals(that.userName) : that.userName != null) return false;
        if (totWalkDis != null ? !totWalkDis.equals(that.totWalkDis) : that.totWalkDis != null) return false;
        if (totRunDis != null ? !totRunDis.equals(that.totRunDis) : that.totRunDis != null) return false;
        if (totCycDis != null ? !totCycDis.equals(that.totCycDis) : that.totCycDis != null) return false;
        if (height != null ? !height.equals(that.height) : that.height != null) return false;
        if (weight != null ? !weight.equals(that.weight) : that.weight != null) return false;
        if (bodyFatRate != null ? !bodyFatRate.equals(that.bodyFatRate) : that.bodyFatRate != null) return false;
        if (totSpoTim != null ? !totSpoTim.equals(that.totSpoTim) : that.totSpoTim != null) return false;
        if (sex != null ? !sex.equals(that.sex) : that.sex != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = userName != null ? userName.hashCode() : 0;
        result = 31 * result + (totWalkDis != null ? totWalkDis.hashCode() : 0);
        result = 31 * result + (totRunDis != null ? totRunDis.hashCode() : 0);
        result = 31 * result + (totCycDis != null ? totCycDis.hashCode() : 0);
        result = 31 * result + (height != null ? height.hashCode() : 0);
        result = 31 * result + (weight != null ? weight.hashCode() : 0);
        result = 31 * result + (bodyFatRate != null ? bodyFatRate.hashCode() : 0);
        result = 31 * result + (totSpoTim != null ? totSpoTim.hashCode() : 0);
        result = 31 * result + (sex != null ? sex.hashCode() : 0);
        result = 31 * result + id;
        return result;
    }

    @ManyToOne
    @JoinColumn(name = "userId", referencedColumnName = "_id", nullable = false)
    public UsertableEntity getUsertableByUserId() {
        return usertableByUserId;
    }

    public void setUsertableByUserId(UsertableEntity usertableByUserId) {
        this.usertableByUserId = usertableByUserId;
    }
}
